Version 2 - #9
Conversation
|
I am still trying to fix the building and exportation so that one does not always need |
|
The exportation has been solved! Works great with multiple entry points! |
| ``` | ||
|
|
||
| Second, you can make use of the `useQueryAndPagination` hook. This package implements 3 versions of this hook: | ||
| There are a variety of entry points from which to import the hooks `useQuery`, `usePagiation` and `useQueryAndPagination`: |
There was a problem hiding this comment.
| There are a variety of entry points from which to import the hooks `useQuery`, `usePagiation` and `useQueryAndPagination`: | |
| There are a variety of entry points from which to import the hooks `useQuery`, `usePagination` and `useQueryAndPagination`: |
| ``` | ||
|
|
||
| ## Information | ||
| ## About |
There was a problem hiding this comment.
I would keep the old title. We have that one in every package.
| >( | ||
| defaultQuery: TQuery, | ||
| schemaQuery: ZodType<TSchemaOutput, TSchemaDef, TSchemaInput>, | ||
| defaultPagination?: PaginationQuery |
There was a problem hiding this comment.
I think the NextRouterOptions are missing here and in the useQuery hook.
options?: Partial<AbstractQueryOptions & NextRouterOptions>
Please also check the other zod routers.
There was a problem hiding this comment.
Good catch! The options have been added
| export type PaginationQuery = { page: number; size: number } | ||
|
|
||
| export type ChangeQueryOptions = { resetPage: boolean } |
There was a problem hiding this comment.
Could you add comments to describe the values. I think especially for resetPage it would not hurt and might not be immediately clear from the name. It would also be nice to see the default value for page, size and resetPage.
There was a problem hiding this comment.
Please have a look at what I added. I think it is explained now.
|
|
||
| export type PaginationQuery = { | ||
| /** | ||
| * The page index. |
There was a problem hiding this comment.
Could you add the default value here and for the size as well?
There are now 3 hooks:
useQuery,usePaginationanduseQueryAndPagination.Those exist for each router: Next.JS router, React Router and in-memory router.
In addition, a more convenient version for zod is exported.
Have a look at the
package.jsonlisting all the entry points. The entry points are specified under theexportskey. The keysmain,typesandmoduleare not necessary since Node.JS 12+.The old tests have been recycled as much as possible.
Changes in behavior:
Have a look at the new
readme.mdfor an introduction to version 2.